<template>
    <div id="bigbox">
        <el-tabs v-model="activeName" class="demo-tabs">
            <el-tab-pane label="商品信息" name="first">
                <div id="topbox">
                    <input id="inp1" type="text" placeholder="请输入商品名称" v-model="inp1"></input>
                    <input id="inp2" type="text" placeholder="请输入品牌名称" v-model="inp2"></input>
                    <el-button @click="sousuo" :icon="Search" circle />
                    <button @click="tianjia" id="tianjia">+添加</button>
                </div>
                <div id="middlebox">
                    <table>
                        <tr>
                            <th>商品照片</th>
                            <th>商品名称</th>
                            <th>价格</th>
                            <th>现有价格</th>
                            <th>折扣</th>
                            <th>
                                <select @change="gaibian" name="" id="se8">
                                    <option value="">商品类别</option>
                                    <option v-for="item in xiala" :value="item.businessId">{{item.businessName}}</option>
                                </select>
                            </th>
                            <th>
                                <select  @change="gaibian1" name="" id="se9">
                                    <option value="">是否下架</option>
                                    <option value="0">否</option>
                                    <option value="1">是</option>
                                </select>
                            </th>
                            <th>库存</th>
                            <th>浏览量</th>
                            <th>商品品牌</th>
                            <th>操作</th>
                        </tr>
                        <template v-for="item in xr">
                            <tr>
                                <td>
                                    <img id="daxiao" :src="url+'images'+item.icon" alt="">
                                </td>
                                <td>{{item.goodsName}}</td>
                                <td>{{item.price}}</td>
                                <td>{{item.todayPrice}}</td>
                                <td>{{item.discount}}</td>
                                <td>{{item.businessName}}</td>
                                <td>{{item.whetherUpOrDrown}}</td>
                                <td>{{item.number}}</td>
                                <td>{{item.pageView}}</td>
                                <td>{{item.brandName}}</td>
                                <td>
                                    <span @click="xiu(item)" id="xiu">修改</span>
                                    <span @click="shan(item)" id="shan">删除</span>
                                </td>
                            </tr>
                        </template>
                        <div class="foot">
                        <el-pagination
                            background
                            layout="prev, pager, next"
                            :total="total"
                            :page-size="pageSize"
                            :page-count="total"
                            @current-change="pageChange"/>
                    </div>
                    </table>
                    <!-- 删除模态框 -->
                    <el-dialog v-model="shanchukuang" width="450" align-center>
                        <div id="shan123">删除</div>
                        <div id="shan123">您确定删除此条信息吗</div>
                        <div>
                            <button @click="shanchujiekou" class="baocun">保存</button>
                            <button class="baocun">取消</button>
                        </div>
                    </el-dialog>
                    <!-- 添加模态框 -->
                    <el-dialog v-model="tianjiakuang" width="450" align-center>
                        <h3 id="shan123">添加商品</h3>
                        <div id="tian123">
                            商品主图：
                        </div>
                        <div id="tian123">
                            商品名称：<input v-model="inp3" type="text" placeholder="请输入商品名称">
                        </div>
                        <div id="tian123">
                            商品价格：<input v-model="inp4" type="text" placeholder="请输入商品价格">
                        </div>
                        <div id="tian123">
                            现在价格：<input v-model="inp5" type="text" placeholder="请输入现在价格">
                        </div>
                        <div id="tian123">
                            折扣：<input v-model="inp6" type="text" placeholder="请输入商品折扣">
                        </div>
                        <div id="tian123">
                            商品类别：<select @change="gaibian2" name="" id="changdu1">
                                <option v-for="item in xiala" :value="item.businessId">{{item.businessName}}</option>
                            </select>
                        </div>
                        <div id="tian123">
                            是否上架：<select @click="gaibian3" name="" id="changdu2">
                                <option value="0">否</option>
                                <option value="1">是</option>
                            </select>
                        </div>
                        <div id="tian123">
                            库存：<input v-model="inp7" type="text" placeholder="请输入库存数量">
                        </div>
                        <div id="tian123">
                            商品品牌：<input v-model="inp8" type="text" placeholder="请输入商品品牌Id">
                        </div>
                        <div id="kuozhan">
                            <button @click="tianjiajiekou" class="baocun1">保存</button>
                            <button class="baocun1">取消</button>
                        </div>
                    </el-dialog>
                    <!-- 修改模态框 -->
                    <el-dialog v-model="xiugaikuang" width="450" align-center>
                        <h3 id="shan123">修改商品</h3>
                        <div id="tian123">
                            商品主图：
                        </div>
                        <div id="tian123">
                            商品名称：<input v-model="inp3" type="text" placeholder="请输入商品名称">
                        </div>
                        <div id="tian123">
                            商品价格：<input v-model="inp4" type="text" placeholder="请输入商品价格">
                        </div>
                        <div id="tian123">
                            现在价格：<input v-model="inp5" type="text" placeholder="请输入现在价格">
                        </div>
                        <div id="tian123">
                            折扣：<input v-model="inp6" type="text" placeholder="请输入商品折扣">
                        </div>
                        <div id="tian123">
                            商品类别：<select @change="gaibian2" name="" id="changdu1">
                                <option v-for="item in xiala" :value="item.businessId">{{item.businessName}}</option>
                            </select>
                        </div>
                        <div id="tian123">
                            是否上架：<select @change="gaibian3" name="" id="changdu2">
                                <option value="0">否</option>
                                <option value="1">是</option>
                            </select>
                        </div>
                        <div id="tian123">
                            库存：<input v-model="inp7" type="text" placeholder="请输入库存数量">
                        </div>
                        <div id="tian123">
                            商品品牌：<input v-model="inp8" type="text" placeholder="请输入商品品牌Id">
                        </div>
                        <div id="kuozhan">
                            <button @click="xiugaijiekou" class="baocun1">保存</button>
                            <button class="baocun1">取消</button>
                        </div>
                    </el-dialog>
                </div>
            </el-tab-pane>
            <!-- 订单信息 -->
            <el-tab-pane label="订单信息" name="second">
                <div id="topbox1">
                    <input id="inp1" type="text" placeholder="请输入商品名称" v-model="inpshuju1">
                    <input id="inp2" type="text" placeholder="请输入订单编号" v-model="inpshuju2">
                    <input id="inp2" type="date" placeholder="请输入开始时间" v-model="inpshuju3">
                    <input id="inp2" type="date" placeholder="请输入结束时间" v-model="inpshuju4">
                    <el-button @click="sousuo1" :icon="Search" circle />
                </div>
                <div id="middlebox">
                    <table>
                        <tr>
                            <th>商品名称</th>
                            <th>订单编号</th>
                            <th>用户</th>
                            <th>下单时间</th>
                            <th>支付时间</th>
                            <th>支付方式</th>
                            <th>应付金额</th>
                            <th>实付金额</th>
                            <th>
                                <select @change="xlshijian" name="" id="heisa">
                                    <option value="">全部</option>
                                    <option value="1">未支付</option>
                                    <option value="2">已支付</option>
                                    <option value="3">未发货</option>
                                    <option value="4">已发货</option>
                                    <option value="5">已完成</option>
                                </select>
                            </th>
                        </tr>
                        <template v-for="item in ddxr">
                            <tr>
                                <td>{{item.goodsName}}</td>
                                <td>{{item.orderNumber}}</td>
                                <td>{{item.userName}}</td>
                                <td>{{item.orderTime}}</td>
                                <td>{{item.payTime}}</td>
                                <td>{{item.platName}}</td>
                                <td>{{item.realPay}}</td>
                                <td>{{item.realPay}}</td>
                                <td  class="green123" v-if="item.status==5">已完成</td>
                                <td  class="red1234" v-else-if="item.status==4">已发送</td>
                                <td  class="red1234" v-else-if="item.status==3">未发送</td>
                                <td  class="red1234" v-else-if="item.status==2">已发货</td>
                                <td  class="red1234" v-else-if="item.status==1">未发货</td>
                            </tr>
                        </template>
                        <div class="foot">
                        <el-pagination
                            background
                            layout="prev, pager, next"
                            :total2="total2"
                            :page-size="pageSize"
                            :page-count="total2"
                            @current-change="pageChange1"/>
                        </div>
                    </table>
                </div>
            </el-tab-pane>
            <!-- 退货信息 -->
            <el-tab-pane label="退货信息" name="third">
                <div id="topbox2">
                    <input id="inp1" type="text" placeholder="请输入商品名称" v-model="inpshuju5">
                    <input id="inp2" type="text" placeholder="请输入订单编号" v-model="inpshuju6">
                    <el-button @click="sousuo2" :icon="Search" circle />
                </div>
                <div id="middlebox">
                    <table>
                        <tr>
                            <th>商品名称</th>
                            <th>订单编号</th>
                            <th>退货原因</th>
                            <th>用户</th>
                            <th>
                                <select @click="gaibianshuju" name="" id="se1">
                                    <option value="">退款状态</option>
                                    <option value="0">提交信息</option>
                                    <option value="1">平台审核</option>
                                    <option value="2">商家同意</option>
                                    <option value="3">正在退货</option>
                                    <option value="4">完成</option>
                                </select>
                            </th>
                            <th>金额</th>
                            <th>操作</th>
                            <th>操作</th>
                        </tr>
                    </table>
                    <template v-for="item in thxr">
                        <tr>
                            <td>{{item.goodsName}}</td>
                            <td>{{item.orderNumber}}</td>
                            <td>{{item.reason}}</td>
                            <td>{{item.userName}}</td>
                            <td v-if="item.returnStatus==0">提交信息</td>
                            <td v-else-if="item.returnStatus==1">平台审核</td>
                            <td v-else-if="item.returnStatus==2">商家同意</td>
                            <td v-else-if="item.returnStatus==3">正在退货</td>
                            <td v-else-if="item.returnStatus==4">完成</td>
                            <td v-else-if="item.returnStatus==5">完成</td>
                            <td>{{item.realPay}}</td>
                            <td>
                                <button @click="tongguo(item,$event)" id="spnshuju1">通过</button>
                                <button @click="butongguo(item,$event)"  id="spnshuju2">不通过</button>
                            </td>
                            <td id="shuju777" v-if="shuju88==item.returnId">退款</td>
                            <td v-else></td>
                        </tr>
                        <div class="foot">
                        <el-pagination
                            background
                            layout="prev, pager, next"
                            :total4="total4"
                            :page-size="pageSize"
                            :page-count="total4"
                            @current-change="pageChange2"/>
                        </div>
                    </template>
                </div>
            </el-tab-pane>
            <!-- 发货信息 -->
            <el-tab-pane label="发货信息" name="fourth">
                <div id="topbox3">
                    <input id="inp1" type="text" placeholder="请输入商品名称" v-model="so1">
                    <input id="inp2" type="text" placeholder="请输入订单编号" v-model="so2">
                    <input id="inp2" type="date" placeholder="请输入开始时间" v-model="so3">
                    <input id="inp2" type="date" placeholder="请输入结束时间" v-model="so4">
                    <input id="inp2" type="text" placeholder="请输入用户名" v-model="so5">
                    <el-button @click="sousuo4" :icon="Search" circle />
                </div>
                <div id="middlebox">
                    <table>
                        <tr>
                            <th>商品名称</th>
                            <th>订单编号</th>
                            <th>下单时间</th>
                            <th>物流单号</th>
                            <th>物流公司</th>
                            <th>用户</th>
                            <th>联系人</th>
                            <th>联系方式</th>
                            <th>状态</th>
                        </tr>
                        <template v-for="item in fhxr">
                            <tr>
                                <td>{{item.goodsName}}</td>
                                <td>{{item.orderNumber}}</td>
                                <td>{{item.orderTime}}</td>
                                <td>{{item.track}}</td>
                                <td>{{item.firm}}</td>
                                <td>{{item.userName}}</td>
                                <td>{{item.contacts}}</td>
                                <td>{{item.tel}}</td>
                                <td v-if="item.status==5">已完成</td>
                                <td v-else-if="item.status==4">已发货</td>
                                <td v-else-if="item.status==3">待发货</td>
                                <td v-else-if="item.status==2">已支付</td>
                                <td v-else-if="item.status==1">未支付</td>
                            </tr>
                        </template>
                        <div class="foot">
                        <el-pagination
                            background
                            layout="prev, pager, next"
                            :total6="total6"
                            :page-size="pageSize"
                            :page-count="total6"
                            @current-change="pageChange3"/>
                        </div>
                    </table>
                </div>
            </el-tab-pane>
            <!-- 商品评价 -->
            <el-tab-pane label="商品评价" name="sixed">
                <div id="topbox4">
                    <input id="inp1" type="text" placeholder="请输入商品名称" v-model="so6">
                    <input id="inp2" type="text" placeholder="请输入订单编号" v-model="so7">
                    <input id="inp2" type="date" placeholder="请输入开始时间" v-model="so8">
                    <input id="inp2" type="date" placeholder="请输入结束时间" v-model="so9">
                    <el-button @click="sousuo5" :icon="Search" circle />
                </div>
                <div id="middlebox">
                    <table>
                        <tr>
                            <th>商品名称</th>
                            <th>评价用户</th>
                            <th>评价内容</th>
                            <th>评价时间</th>
                            <th>星级</th>
                            <th>操作</th>
                        </tr>
                        <template v-for="item in pjxr">
                            <tr>
                                <td>{{item.goodsName}}</td>
                                <td>{{item.userName}}</td>
                                <td>{{item.content}}</td>
                                <td>{{item.contentTime}}</td>
                                <td>{{item.start}}</td>
                                <td @click="huifu(item)" id="green1">回复</td>
                            </tr>
                        </template>
                        <div class="foot">
                        <el-pagination
                            background
                            layout="prev, pager, next"
                            :total8="total8"
                            :page-size="pageSize"
                            :page-count="total8"
                            @current-change="pageChange4"/>
                        </div>
                    </table>
                </div>
            </el-tab-pane>
        </el-tabs>

        <el-dialog v-model="butongguokuang" width="450" align-center>
            <h2>不通过原因</h2>
            <div id="shuju123"><input type="text" v-model="yuanyinshuju"></div>
            <div id="shuju1234">
                <button @click="yuanyin" id="btn123">保存</button>
                <button id="btn123">取消</button>
            </div>
        </el-dialog>

        <el-dialog v-model="huifukuang" width="450" align-center>
            <h2>回复</h2>
            <div id="shuju123">客户评价：<input type="text" v-model="moren.content"></div>
            <div id="shuju123">回复：<input type="text" v-model="huifushuju"></div>
            <div id="shuju1234">
                <button @click="huifushijian" id="btn123">保存</button>
                <button id="btn123">取消</button>
            </div>
        </el-dialog>
    </div>
</template>
<style scoped>
    .green123{
        color:green;
    }
    .red1234{
        color:red;
    }
    #kuozhan{
        width:100%;
        height:50px;
        line-height: 50px;
        margin-top:10%;
    }
    #changdu1{
        width:40%;
        height:20px;
    }
    #changdu2{
        width:40%;
        height:20px;
    }
    #se1{
        font-weight: 800;
        border: 0px;
    }
    #heisa{
        font-weight: 800;
        border: 0px;
    }
    #se8{
        font-weight: 800;
        border: 0px;
    }
    #se9{
        font-weight: 800;
        border: 0px;
    }
    #green1{
        color:green;
    }
    #btn123{
        width:20%;
        height:40px;
        margin-left:20%;
        border-radius: 5px;
        background-color: #5981E1;
        color:#fff;
    }
    #shuju1234{
        width:100%;
        height:80px;
        line-height:80px;
    }
    #shuju123{
        width:100%;
        height:80px;
        text-align: center;
        line-height:80px;
    }
    h2{
        width:100%;
        height:50px;
        text-align: center;
        line-height:50px;
    }
    #spnshuju1{
        color:green;
        margin-right:10%;
        background-color: #fff;
        border:0px;
    }
    #spnshuju2{
        color:red;
        border:0px;
        background-color: #fff;
    }
    #tianjia{
        width:10%;
        height:30px;
        background-color: #5981E2;
        color: #fff;
        text-align: center;
        margin-left:52%;
        border:0px;
        border-radius: 5px;
    }
    .baocun{
        width:20%;
        height:40px;
        border-radius: 10px;
        margin-left:21%;
        background-color: #5981E1;
        color: #fff;
    }
    #shan123{
        width:100%;
        height:30px;
        text-align: center;
        line-height:30px;
        margin-bottom:6%;
    }
    #tian123{
        width:100%;
        height:30px;
        text-align: center;
        line-height:30px;
        margin-bottom:2%;
    }
    #xiu{
        color:green;
        margin-right:10%;
    }
    #shan{
        color:red;
    }
    #bigbox{
        width:100%;
        height:100%;
        background-color: #F5F5F5;
    }
    .demo-tabs > .el-tabs__content {
        padding: 32px;
        color: #6b778c;
        font-size: 32px;
        font-weight: 600;
    }
    #topbox{
        width:90%;
        height:60px;
        margin-left:5%;
        line-height:50px;
    }
    #topbox3{
        width:90%;
        height:60px;
        margin-left:5%;
        line-height:50px;
    }
    #topbox4{
        width:90%;
        height:60px;
        margin-left:5%;
        line-height:50px;
    }
    #inp1{
        height:30px;
        width:15%;
        margin-right:1%;
        padding-left:1%;
        border-radius: 5px;
        border:0px;
        box-shadow: 1px 3px #ccc;
        outline: none;
    }
    #inp2{
        height:30px;
        width:15%;
        margin-right:1%;
        padding-left:1%;
        border-radius: 5px;
        border:0px;
        box-shadow: 1px 3px #ccc;
        outline: none;
    }
    .el-button.is-circle {
        border-radius: 25%;
        padding: 8px;
        width: 32px;
        position: relative;
    }
    .el-button{
        background-color: #5981E2;
        color: #fff;
        font-size:20px;
    }
    #middlebox{
        width:90%;
        height:450px;
        margin-left:5%;
        background-color: #fff;
    }
    table{
        width:100%;
    }
    th,td{
        padding-top:2%;
        width:5%;
        text-align: center;
        font-size:14px;
    }
    .foot{
        width: 90%;
        height:0%;
        display: flex;
        justify-content: center;
        position: absolute;
        bottom: 41px;
    }
    .el-pagination{
        justify-content: center;
    }
    option{
        text-align: center;
    }
    #topbox1{
        width:90%;
        height:60px;
        margin-left:5%;
        line-height:50px;
    }
    #topbox2{
        width:90%;
        height:60px;
        margin-left:5%;
        line-height:50px;
    }
    :deep(.el-tabs__nav-wrap::after) {
        position: static !important;
        }
        :deep(.el-tabs__nav-scroll){
            padding-left: 30px;
            background-color: #fff;
        }
    #shuju777{
        color:red;
    }
    #daxiao{
        width:40px;
        height:40px;
    }
    .baocun1{
        width:20%;
        height:40px;
        border-radius: 10px;
        margin-left:21%;
        background-color: #5981E1;
        color: #fff;
    }
</style>
<script setup>
    import { onMounted, ref } from 'vue'
    import {Search} from '@element-plus/icons-vue'
    import { ElMessage} from 'element-plus'
    import axios from 'axios';
    const activeName = ref('first')
    let pageSize = 5;
    let currentPage = ref(1);
    let currentPage1 = ref(1);
    let currentPage2 = ref(1);
    let currentPage3 = ref(1);
    let currentPage4 = ref(1);
    let total = ref(1);
    let total2 = ref(1);
    let total4 = ref(1);
    let total6 = ref(1);
    let total8 = ref(1);
    let inp1=ref("");
    let inp2=ref("");
    let inp3=ref("");
    let inp4=ref("");
    let inp5=ref("");
    let inp6=ref("");
    let inp7=ref("");
    let inp8=ref("");
    let xiala=ref("");
    let inpshuju1=ref("");
    let inpshuju2=ref("");
    let inpshuju3=ref("");
    let inpshuju4=ref("");
    let inpshuju5=ref("");
    let inpshuju6=ref("");
    let so1=ref("");
    let so2=ref("");
    let so3=ref("");
    let so4=ref("");
    let so5=ref("");
    let so6=ref("");
    let so7=ref("");
    let so8=ref("");
    let so9=ref("");
    let yuanyinshuju=ref("");
    let shanchukuang=ref(false)
    let tianjiakuang=ref(false)
    let xiugaikuang=ref(false)
    let butongguokuang=ref(false)
    let huifukuang=ref(false)
    let huifushuju=ref("")
    let moren=ref("")
    let url=ref("http://192.168.199.11:8001/ShoppingStreet/")
    let shuju88=ref();
    //渲染商品信息数组
    let xr=ref([]);
    //渲染订单信息数组
    let ddxr=ref([]);
    //退货信息渲染数组
    let thxr=ref([]);
    //发货信息渲染数组
    let fhxr=ref([]);
    //评价信息渲染数组
    let pjxr=ref([]);
    const pageChange = (newPage) => {
        currentPage.value = newPage;
        xuanran();
    };
    const pageChange1 = (newPage) => {
        currentPage1.value = newPage;
        dingdanxuanran();
    };
    const pageChange2 = (newPage) => {
        currentPage2.value = newPage;
        thxuanran();
    };
    const pageChange3 = (newPage) => {
        currentPage3.value = newPage;
        fhxuanran();
    };
    const pageChange4 = (newPage) => {
        currentPage4.value = newPage;
        pjxuanran();
    };
    onMounted(()=>{
        xuanran();
        thxuanran();
        dingdanxuanran();
        xlk1();
        fhxuanran();
        pjxuanran();
    })
    //初始列表渲染
    function xuanran(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/merchantGoods/goodsList`,
        {
            pageIndex:currentPage.value,
            pageSize:pageSize,
            adminId:Number(localStorage.getItem("adminId")),
        })
        .then(function(res){
            console.log(res);         
            var qwe=res.data.data.oeders;
            total.value=res.data.data.pageCount;
            xr.value=qwe;
            console.log(xr.value);
        })
    }
    //搜索接口
    function sousuo(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/merchantGoods/searchGoods`,
        {
            pageIndex:currentPage.value,
            pageSize:pageSize,
            adminId:Number(localStorage.getItem("adminId")),
            goodsName:inp1.value,
            brandName:inp2.value,
        })
        .then(function(res){
            console.log(res);
            var qwe=res.data.data.oeders
            total.value=res.data.data.pageCount;
            xr.value=qwe
            ElMessage({
                type:"success",
                message:"搜索成功"
            })
        })
    }
    //商品类别下拉框数据1
    function xlk1(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/shop/businessList`,
        {
        })
        .then(function(res){
            var qwe=res.data.data;
            xiala.value=qwe;
            console.log(xiala.value);
        })
    }
    //商品类别下拉框数据2
    function gaibian(event){
        console.log(event.target.value);
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/merchantGoods/searchBrand`,
        {
            pageIndex:currentPage.value,
            pageSize:pageSize,
            adminId:Number(localStorage.getItem("adminId")),
            businessId:Number(event.target.value),
        })
        .then(function(res){
            var qwe=res.data.data.oeders;
            console.log(qwe);
            xr.value=qwe;
        })
    }
    //是否下架下拉列表
    function gaibian1(event){
        console.log(event.target.value);
        
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/merchantGoods/whetherUpOrDrown`,
        {
            pageIndex:currentPage.value,
            pageSize:pageSize,
            adminId:Number(localStorage.getItem("adminId")),
            whetherUpOrDrown:event.target.value,
        })
        .then(function(res){
            console.log(res);
            var qwe=res.data.data.oeders;
            console.log(qwe);
            xr.value=qwe;
        })
    }
    function gaibian2(event){
        console.log(event.target.value); 
        localStorage.setItem("shuju",event.target.value)
    }
    function gaibian3(event){
        console.log(event.target.value); 
        localStorage.setItem("shuju1",event.target.value)
    }
    //显示删除模态框
    function shan(item){
        shanchukuang.value=true;
        console.log(item.goodsId);
        localStorage.setItem("goodsId",item.goodsId)
    }
    //调取删除接口
    function shanchujiekou(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/merchantGoods/deleteGoods`,
        {
            goodsId:Number(localStorage.getItem("goodsId")),
            delflag:"1",
        })
        .then(function(res){
            console.log(res);
            shanchukuang.value=false;
            xuanran();
        })
    }
    //显示添加模态框
    function tianjia(){
        tianjiakuang.value=true;
    }
    function tianjiajiekou(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/merchantGoods/addGoods`,
        {
            goodsName:inp3.value,
            price:Number(inp4.value),
            todayPrice:Number(inp5.value),
            discount:Number(inp6.value),
            businessId:Number(localStorage.getItem("shuju")),
            whetherUpOrDrown:Number(localStorage.getItem("shuju1")),
            number:Number(inp7.value),
            brandId:Number(inp8.value),
            shopId:Number(localStorage.getItem("shopId")),
        })
        .then(function(res){
            console.log(res);
            tianjiakuang.value=false;
            xuanran();
        })
    }
    //修改模态框显示
    function xiu(item){
        xiugaikuang.value=true;
        localStorage.setItem("goodsIds",item.goodsId)
    }
    //修改接口
    function xiugaijiekou(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/merchantGoods/updateGoods`,
        {
            goodsName:inp3.value,
            price:Number(inp4.value),
            todayPrice:Number(inp5.value),
            discount:Number(inp6.value),
            businessId:Number(localStorage.getItem("shuju")),
            whetherUpOrDrown:Number(localStorage.getItem("shuju1")),
            number:Number(inp7.value),
            brandId:Number(inp8.value),
            shopId:Number(localStorage.getItem("shopId")),
            goodsId:Number(localStorage.getItem("goodsIds"))
        })
        .then(function(res){
            console.log(res);
            xiugaikuang.value=false;
            xuanran();
        })
    }
    //订单信息列表渲染
    function dingdanxuanran(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/ordersList`,
        {
            pageIndex:currentPage1.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
        })
        .then(function(res){
            console.log(res);
            var qwe=res.data.data.ordersList;
            total2.value=res.data.data.pageCount;
            console.log(total2.value);
            ddxr.value=qwe;
            console.log(ddxr.value);
        })
    }
    //支付状态下拉框
    function xlshijian(event){
        console.log(event.target.value);
        
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/ordersPay`,
        {
            pageIndex:currentPage.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
            status:Number(event.target.value),
        })
        .then(function(res){
            console.log(res);
            
            var qwe=res.data.data.ordersList;
            ddxr.value=qwe;
            console.log(ddxr.value);
        })
    }
    //订单信息查询
    function sousuo1(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/searchOrder`,
        {
            pageIndex:currentPage1.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
            goodsName:inpshuju1.value,
            orderNumber:inpshuju2.value,
            statrTime:inpshuju3.value,
            endTime:inpshuju4.value,
        })
        .then(function(res){
            var qwe=res.data.data.ordersList;
            total2.value=res.data.data.pageCount;
            ddxr.value=qwe;
            console.log(ddxr.value);
            ElMessage({
                type:"success",
                message:"搜索成功"
            })
        })
    }
    //退货列表渲染
    function thxuanran(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/Return`,
        {
            pageIndex:currentPage2.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
        })
        .then(function(res){ 
            var qwe=res.data.data.ReturnList;
            total4.value=res.data.data.pageCount;
            thxr.value=qwe;
            console.log(thxr.value);
        })
    }
    //退货搜索接口
    function sousuo2(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/Return`,
        {
            pageIndex:currentPage2.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
            orderNumber:inpshuju6.value,
            goodsName:inpshuju5.value,
        })
        .then(function(res){
            console.log(res);
            var qwe=res.data.data.ReturnList;
            total4.value=res.data.data.pageCount;
            thxr.value=qwe;
            console.log(thxr.value);
            ElMessage({
                type:"success",
                message:"搜索成功"
            })
        })
    }
    //下拉框退款状态
    function gaibianshuju(event){
        console.log(event.target.value);
        
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/Return`,
        {
            pageIndex:currentPage.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
            returnStatus:event.target.value,
        })
        .then(function(res){
            console.log(res);
            var qwe=res.data.data.ReturnList;
            thxr.value=qwe;
            console.log(thxr.value);
        })
    }
    //通过接口
    function tongguo(item,event){
        var asd=event.target
        console.log(item.returnId);
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/updateRSa`,
        {
            returnId:Number(item.returnId),
            delflag:1,
        })
        .then(function(res){
            console.log(res);
            ElMessage({
                type:"success",
                message:"退款通过"
            })
            asd.disabled=true;
            asd.style.color="#ccc"
            event.target.nextSibling.style.display="none";
            shuju88.value=item.returnId;
        })
    }
    //不通过点击接口
    function butongguo(item,event){
        console.log(item.returnId,item.reason);
        localStorage.setItem("returnId",item.returnId)
        localStorage.setItem("reason",item.reason)
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/updateRSa`,
        {
            returnId:Number(item.returnId),
            delflag:0,
        })
        .then(function(res){
            console.log(res);
            butongguokuang.value=true;
            event.target.disabled=true;
            event.target.style.color="#ccc";
            event.target.previousSibling.style.display="none"
        })
    }
    //不通过原因接口
    function yuanyin(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/updateRSa`,
        {
            returnId:Number(localStorage.getItem("returnId")),
            email:"209359191@qq.com",
            reason:yuanyinshuju.value,
        })
        .then(function(res){
            console.log(res);
            butongguokuang.value=false;
            ElMessage({
                type:"success",
                message:"原因发送成功"
            })
        })
    }
    //发货信息列表渲染
    function fhxuanran(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/informationList`,
        {
            pageIndex:currentPage3.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
        })
        .then(function(res){
            var qwe=res.data.data.informationList;
            total6.value=res.data.data.pageCount;
            fhxr.value=qwe;
            console.log(fhxr.value);
        })
    }
    //发货信息查询接口
    function sousuo4(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/orders/informationSearch`,
        {
            pageIndex:currentPage3.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
            goodsName:so1.value,
            orderNumber:so2.value,
            statrTime:so3.value,
            endTime:so4.value,
            userName:so5.value,
        })
        .then(function(res){
            console.log(res);
            var qwe=res.data.data.informationSearch;
            total6.value=res.data.data.pageCount;
            fhxr.value=qwe;
            ElMessage({
                type:"success",
                message:"搜索成功"
            })
        })
    }
    //商品评价渲染接口
    function pjxuanran(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/comment/commentList`,
        {
            pageIndex:currentPage4.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
        })
        .then(function(res){
            var qwe=res.data.data.commentList;
            total8.value=res.data.data.pageCount;
            pjxr.value=qwe;
            console.log(pjxr.value);
        })
    }
    //商品评价搜索接口
    function sousuo5(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/comment/searchComment`,
        {
            pageIndex:currentPage4.value,
            pageSize:pageSize,
            shopId:Number(localStorage.getItem("shopId")),
            goodsName:so6.value,
            userName:so7.value,
            statrTime:so8.value,
            endTime:so9.value,
        })
        .then(function(res){
            console.log(res);
            var qwe=res.data.data.searchList;
            total8.value=res.data.data.pageCount;
            pjxr.value=qwe;
            ElMessage({
                type:"success",
                message:"搜索成功"
            })
        })
    }
    //回复框显示
    function huifu(item){
        huifukuang.value=true;
        localStorage.setItem("commentId",item.commentId)
        localStorage.setItem("goodsId",item.goodsId)
        moren.value=item
    }
    function huifushijian(){
        axios.defaults.headers.common['token'] = localStorage.getItem("token");
        axios.post(`http://192.168.199.11:8001/ShoppingStreet/comment/reply`,
        {
            shopReplyId:Number(localStorage.getItem("commentId")),
            shopId:Number(localStorage.getItem("shopId")),
            goodsId:Number(localStorage.getItem("goodsId")),
            content:huifushuju.value,
        })
        .then(function(res){
            console.log(res);
            ElMessage({
                type:"success",
                message:"回复成功"
            })
            huifukuang.value=false;
            pjxuanran();
        })
    }
</script>